function [] = multiPlot (varargin)

nArgs = length(varargin);
if ((nArgs-1) / 5 ~= round((nArgs-1) / 5)), error('Bad'); end
numFigs = (nArgs-1)/5;

left= 0.1;
width=0.82;
separation = 0.04;
bottom = 0.1 + ((1 - 0.1)/numFigs)*(0:(numFigs-1));
if (numFigs == 1) height=0.8; else height = bottom(2)-bottom(1)-separation; end %0.45; % which is also bottom1-bottom2

xLabelTitle = varargin(1);
figure;
for f=1:numFigs
    indexFirstArg = 2 + 5*(f-1);
    yLabelTitle = varargin{indexFirstArg};
    timeAndData = varargin{indexFirstArg+1};
    optData = varargin{indexFirstArg+2};
    thisAxis = varargin{indexFirstArg+3};
    plotOptions = varargin{indexFirstArg+4};
    
    axes( 'Position',[left bottom(f) width height],'FontName' , 'Times' ,'FontSize' , 11);
    t=timeAndData(:,1); data=timeAndData(:,2:end); 
    plot(t, data , plotOptions); 
    hold;
    if ~isempty(optData), for val=optData, plot (max(t),val,'sb'); end; end
    ylabel(yLabelTitle,'FontName' , 'Times' ,'FontSize' , 11);
    set(gca, 'FontName' , 'Times' , 'FontSize', 11);
    if f>1
        set(gca, 'XTickLabel', [],'XTick',[]);
    else
        xlabel(xLabelTitle,'FontName' , 'Times' ,'FontSize' , 11);
    end
    
    if (numel(thisAxis) > 0)
        axis ([min(t) max(t) thisAxis(1) thisAxis(2)]);
    else
        if isempty(optData)
            minValue = min(data(:));
            maxValue =  max(data(:));
        else
            minValue = min(min(optData(:)),min(data(:)));
            maxValue =  max(max(optData(:)),max(data(:)));
        end     
        if (minValue < 0), minValue = minValue*1.1; else minValue=minValue*0.9; end
        if (maxValue < 0), maxValue = maxValue*0.9; else maxValue=maxValue*1.1; end
        if (minValue == maxValue), minValue = minValue - 1; maxValue = maxValue + 1; end
        axis ([min(t) max(t) minValue maxValue]);
    end
end


